package jsyf.oa.web.device;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ExportExcel;
import jsyf.com.util.FastJsonConvert;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.device.DeviceDisplaceFacade;
import jsyf.oa.web.socket.MyWebSocketHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.socket.TextMessage;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static jsyf.oa.web.device.DeviceSampleController.matchResult;

/**
 * Created by y on 2018/7/3.
 */
@Api(value = "设备置换接口", description = "设备置换接口")
@Controller
@RequestMapping("/deviceDisplace")
public class deviceDisplaceController {
    @Resource
    private DeviceDisplaceFacade deviceDisplaceFacade;
    @Autowired
    private MyWebSocketHandler myWebSocketHandler;
    @ResponseBody
    @RequestMapping(value = "/getDisplaceList.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "查询旧机列表",
            notes = "查询旧机列表 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{type:'1'}", dataType = "String", paramType = "body")
    public void getDisplaceList(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = this.deviceDisplaceFacade.getDisplaceList(jsonData);
        if (null != records) {
            ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjHourRespond(records));
        } else {
            ResponseUtils.putJsonResponse(response, BaseUtils.errorrRespond("查找失败"));
        }
    }

    @ResponseBody
    @RequestMapping(value = "/getDisplaceListNew.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "查询旧机列表",
            notes = "查询旧机列表 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{type:'1'}", dataType = "String", paramType = "body")
    public void getDisplaceListNew(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = this.deviceDisplaceFacade.getDisplaceListNew(jsonData);
        if (null != records) {
            ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjHourRespond(records));
        } else {
            ResponseUtils.putJsonResponse(response, BaseUtils.errorrRespond("查找失败"));
        }
    }

    @ResponseBody
    @RequestMapping(value = "/getDisplaceById.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "根据id获取",
            notes = "根据id获取",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "id:''", dataType = "String", paramType = "body")
    public void getDisplaceById(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = this.deviceDisplaceFacade.getDisplaceById(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/save.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "旧机设备信息入库",
            notes = "旧机设备信息入库",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "DisplaceEntity:''", dataType = "String", paramType = "body")
    public void save(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.save(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/saveOldSample.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "新旧机设备信息入库",
            notes = "新旧机设备信息入库",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "DisplaceEntity:''", dataType = "String", paramType = "body")
    public void saveOldSample(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.saveOldSample(jsonData);
        //发送消息
        sendMessage(records.getString("message"));
        records.remove("message");
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/saveHouse.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "旧机设备信息入库",
            notes = "旧机设备信息入库",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "DisplaceEntity:''", dataType = "String", paramType = "body")
    public void saveHouse(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.saveHouse(jsonData);
        //发送消息
        sendMessage(records.getString("message"));
        records.remove("message");
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(records));
    }

    @RequestMapping(value = "/applyAudit.json", method = RequestMethod.POST)
    public void applyAudit(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = deviceDisplaceFacade.applyAudit(jsonData);
        boolean flag = Boolean.parseBoolean(result.getString("flag"));
        //发送消息
        sendMessage(result.getString("message"));
        if (flag) {
            ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond("审核成功"));
        } else {
            ResponseUtils.putJsonResponse(response, BaseUtils.errorrRespond("审核驳回"));
        }
    }

    @ResponseBody
    @RequestMapping(value = "/saveTransport.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "旧机运输信息入库",
            notes = "旧机运输信息入库",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "DisplaceEntity:''", dataType = "String", paramType = "body")
    public void saveTransport(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.saveTransport(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/saveChange.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "物流变更信息入库",
            notes = "物流变更信息入库",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "DisplaceEntity:''", dataType = "String", paramType = "body")
    public void saveChange(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.saveChange(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/delById.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "",
            notes = "",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "id:''", dataType = "String", paramType = "body")
    public void delById(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.delById(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/removeById.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "",
            notes = "",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "id:''", dataType = "String", paramType = "body")
    public void removeById(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.removeById(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/outBound.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "旧机出库",
            notes = "旧机出库",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "DisplaceEntity:''", dataType = "String", paramType = "body")
    public void outBound(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject jsonResult = this.deviceDisplaceFacade.outBound(jsonData);
        //发送消息
        sendMessage(jsonResult.getString("message"));
        jsonResult.remove("message");
        JSONObject obj = new JSONObject();
        obj.put("records", jsonResult.getString("id"));
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(obj));
    }

    @ResponseBody
    @RequestMapping(value = "/findCompanyList.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "查询公司列表",
            notes = "查询公司列表",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "companyId:''", dataType = "String", paramType = "body")
    public void findCompanyList(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.findCompanyList(jsonData);
        if (null != records) {
            ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjHourRespond(records));
        } else {
            ResponseUtils.putJsonResponse(response, BaseUtils.errorrRespond("查找失败"));
        }
    }

    @ResponseBody
    @RequestMapping(value = "/findRegionByCompanyId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "查询区域",
            notes = "查询区域",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "companyId:''", dataType = "String", paramType = "body")
    public void findRegionByCompanyId(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.findRegionByCompanyId(jsonData);
        if (null != records) {
            ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjHourRespond(records));
        } else {
            ResponseUtils.putJsonResponse(response, BaseUtils.errorrRespond("查找失败"));
        }
    }

    @ResponseBody
    @RequestMapping(value = "/findBigRegionManagerByRegionId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "查询大区经理",
            notes = "查询大区经理",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{regionId:''}", dataType = "String", paramType = "body")
    public void findBigRegionManagerByRegionId(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.findBigRegionManagerByRegionId(jsonData);
        if (null != records) {
            ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjHourRespond(records));
        } else {
            ResponseUtils.putJsonResponse(response, BaseUtils.errorrRespond("查找失败"));
        }
    }

    @ResponseBody
    @RequestMapping(value = "/findRegionManagerByBigRegionManagerId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "查询区域经理",
            notes = "查询区域经理",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{bigRegionManagerId:''}", dataType = "String", paramType = "body")
    public void findRegionManagerByBigRegionManagerId(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.findRegionManagerByBigRegionManagerId(jsonData);
        if (null != records) {
            ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjHourRespond(records));
        } else {
            ResponseUtils.putJsonResponse(response, BaseUtils.errorrRespond("查找失败"));
        }
    }
    @ResponseBody
    @RequestMapping(value = "/getBigManagerAndRegion.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "查询大区经理及区域",
            notes = "查询大区经理及区域",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:''}", dataType = "String", paramType = "body")
    public void getBigManagerAndRegion(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = deviceDisplaceFacade.getBigManagerAndRegion(jsonData);
        if (null != records) {
            ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjHourRespond(records));
        } else {
            ResponseUtils.putJsonResponse(response, BaseUtils.errorrRespond("查找失败"));
        }
    }
    public static String matchResult(Pattern p, String str)
    {
        StringBuilder sb = new StringBuilder();
        Matcher m = p.matcher(str);
        while (m.find())
            for (int i = 0; i <= m.groupCount(); i++)
            {
                sb.append(m.group());
            }
        return sb.toString();
    }
    @RequestMapping(value = "/exportOldSample.json", method = RequestMethod.GET)
    public void exportOldSample(HttpServletResponse response,@RequestParam String jsonData) throws Exception {
        //导出表名、列名
        String[] parmas = jsonData.split(",");
        List<String> row=new ArrayList<String>();
        List<String> data=new ArrayList<String>();
        for(int i=0;i<parmas.length;i++){
            String regEx1 = "[\\u4e00-\\u9fa5]";
            //String regEx2 = "[a-z||A-Z]";
            String regEx3 = "[0-9]";
            String str = parmas[i];
            String s1 = matchResult(Pattern.compile(regEx1),str);
            //String s2 = matchResult(Pattern.compile(regEx2),str);
            String s3 = matchResult(Pattern.compile(regEx3),str);
            //System.out.println(s1+"\n"+s2+"\n"+s3);
            row.add(s1);
            data.add(s3);
        }
        String[] rowsName=new String[row.size()];
        row.toArray(rowsName);//获得列名转换为数组;
        String title = "旧机信息";
        List<Object[]> dataList = new ArrayList<Object[]>();
        Object[] objs = null;
        Object[] objs1=null;
        List<JSONObject> jsonObjectList=deviceDisplaceFacade.getExportList("1");
        for (int i = 0; i < jsonObjectList.size(); i++) {
            JSONObject jsonObject = jsonObjectList.get(i);
            objs = new Object[38];
            objs[0] = jsonObject.get("companyName");
            objs[1] = jsonObject.get("regionName");
            objs[2] = jsonObject.get("bigManagerName");
            objs[3] = jsonObject.get("regionManagerName");
            objs[4] = jsonObject.get("brandName");
            objs[5] = jsonObject.get("replaceMentType");
            objs[6] = jsonObject.get("modelName");
            objs[7] = jsonObject.get("sequence");
            objs[8] = jsonObject.get("factoryDate");
            objs[9] = jsonObject.get("hours");
            objs[10] = jsonObject.get("state");
            objs[11] = jsonObject.get("storeAddress");
            objs[12] = jsonObject.get("estimatePrice");
            objs[13] = jsonObject.get("replacementPrice");
            objs[14] = jsonObject.get("sellPrice");
            objs[15] = jsonObject.get("replacementSubsidy");
            objs[16] = jsonObject.get("fileName");
            objs[17] = jsonObject.get("departure");
            objs[18] = jsonObject.get("destination");
            objs[19] = jsonObject.get("transportCompany");
            objs[20] = jsonObject.get("freight");
            objs[21] = jsonObject.get("deduction");
            objs[22] = jsonObject.get("deductionInstructions");
            objs[23] = jsonObject.get("modelCarLicense");
            objs[24] = jsonObject.get("driverName");
            objs[25] = jsonObject.get("driverTel");
            objs[26] = jsonObject.get("outType");
            objs[27] = jsonObject.get("contractNo");
            objs[28] = jsonObject.get("pickUpAddress");
            objs[29] = jsonObject.get("delivery_address");
            objs[30] = jsonObject.get("outTransportCompany");
            objs[31] = jsonObject.get("outSpecialFee");
            objs[32] = jsonObject.get("outDeductionFee");
            objs[33] = jsonObject.get("outDeductionRemark");
            objs[34] = jsonObject.get("outDrayLicense");
            objs[35] = jsonObject.get("outDriverName");
            objs[36] = jsonObject.get("outDriverTel");
            objs[37] = jsonObject.get("remark");
            dataList.add(objs);
        }
//插数据
        List<Object[]> newDataList = new ArrayList<Object[]>();
        for(int a=0;a<dataList.size();a++){
            objs1 = new Object[data.size()];
            for(int j=0;j<data.size();j++){
                objs1[j]=dataList.get(a)[Integer.parseInt(data.get(j))];
            }
            newDataList.add(objs1);
        }
        ExportExcel ex = new ExportExcel(title, rowsName, newDataList, response);
        ex.export();
    }
    @RequestMapping(value = "/exportOldCar.json", method = RequestMethod.GET)
    public void exportOldCar(HttpServletResponse response,@RequestParam String jsonData) throws Exception {
        //导出表名、列名
        String[] parmas = jsonData.split(",");
        List<String> row=new ArrayList<String>();
        List<String> data=new ArrayList<String>();
        for(int i=0;i<parmas.length;i++){
            String regEx1 = "[\\u4e00-\\u9fa5]";
            //String regEx2 = "[a-z||A-Z]";
            String regEx3 = "[0-9]";
            String str = parmas[i];
            String s1 = matchResult(Pattern.compile(regEx1),str);
            //String s2 = matchResult(Pattern.compile(regEx2),str);
            String s3 = matchResult(Pattern.compile(regEx3),str);
            //System.out.println(s1+"\n"+s2+"\n"+s3);
            row.add(s1);
            data.add(s3);
        }
        String[] rowsName=new String[row.size()];
        row.toArray(rowsName);//获得列名转换为数组;
        String title = "旧车信息";
        List<Object[]> dataList = new ArrayList<Object[]>();
        Object[] objs = null;
        Object[] objs1=null;
        List<JSONObject> jsonObjectList=deviceDisplaceFacade.getExportList("2");
        for (int i = 0; i < jsonObjectList.size(); i++) {
            JSONObject jsonObject = jsonObjectList.get(i);
            objs = new Object[19];
            objs[0] = jsonObject.get("companyName");
            objs[1] = jsonObject.get("regionName");
            objs[2] = jsonObject.get("bigManagerName");
            objs[3] = jsonObject.get("regionManagerName");
            objs[4] = jsonObject.get("brandName");
            objs[5] = jsonObject.get("replaceMentType");
            objs[6] = jsonObject.get("modelName");
            objs[7] = jsonObject.get("sequence");
            objs[8] = jsonObject.get("factoryDate");
            objs[9] = jsonObject.get("kilometers");
            objs[10] = jsonObject.get("storeAddress");
            objs[11] = jsonObject.get("state");
            objs[12] = jsonObject.get("transfer");
            objs[13] = jsonObject.get("insuranceExpirationDate");
            objs[14] = jsonObject.get("estimatePrice");
            objs[15] = jsonObject.get("replacementPrice");
            objs[16] = jsonObject.get("sellPrice");
            objs[17] = jsonObject.get("fileName");
            objs[18] = jsonObject.get("remark");
            dataList.add(objs);
        }
        //插数据
        List<Object[]> newDataList = new ArrayList<Object[]>();
        for(int a=0;a<dataList.size();a++){
            objs1 = new Object[data.size()];
            for(int j=0;j<data.size();j++){
                objs1[j]=dataList.get(a)[Integer.parseInt(data.get(j))];
            }
            newDataList.add(objs1);
        }
        ExportExcel ex = new ExportExcel(title, rowsName, newDataList, response);
        ex.export();
    }
    @RequestMapping(value = "/exportOldHouse.json", method = RequestMethod.GET)
    public void exportOldHouse(HttpServletResponse response,@RequestParam String jsonData) throws Exception {
        //导出表名、列名
        String[] parmas = jsonData.split(",");
        List<String> row=new ArrayList<String>();
        List<String> data=new ArrayList<String>();
        for(int i=0;i<parmas.length;i++){
            String regEx1 = "[\\u4e00-\\u9fa5]";
            //String regEx2 = "[a-z||A-Z]";
            String regEx3 = "[0-9]";
            String str = parmas[i];
            String s1 = matchResult(Pattern.compile(regEx1),str);
            //String s2 = matchResult(Pattern.compile(regEx2),str);
            String s3 = matchResult(Pattern.compile(regEx3),str);
            //System.out.println(s1+"\n"+s2+"\n"+s3);
            row.add(s1);
            data.add(s3);
        }
        String[] rowsName=new String[row.size()];
        row.toArray(rowsName);//获得列名转换为数组;
        String title = "旧房信息";
        List<Object[]> dataList = new ArrayList<Object[]>();
        Object[] objs = null;
        Object[] objs1=null;
        List<JSONObject> jsonObjectList=deviceDisplaceFacade.getExportList("3");
        for (int i = 0; i < jsonObjectList.size(); i++) {
            JSONObject jsonObject = jsonObjectList.get(i);
            objs = new Object[18];
            objs[0] = jsonObject.get("companyName");
            objs[1] = jsonObject.get("regionName");
            objs[2] = jsonObject.get("bigManagerName");
            objs[3] = jsonObject.get("regionManagerName");
            objs[4] = jsonObject.get("replaceMentType");
            objs[5] = jsonObject.get("storeAddress");
            objs[6] = jsonObject.get("houseName");
            objs[7] = jsonObject.get("buildingNumber");
            objs[8] = jsonObject.get("houseAddress");
            objs[9] = jsonObject.get("area");
            objs[10] = jsonObject.get("housesProperty");
            objs[11] = jsonObject.get("state");
            objs[12] = jsonObject.get("transfer");
            objs[13] = jsonObject.get("estimatePrice");
            objs[14] = jsonObject.get("replacementPrice");
            objs[15] = jsonObject.get("sellPrice");
            objs[16] = jsonObject.get("fileName");
            objs[17] = jsonObject.get("remark");
            dataList.add(objs);
        }
        //插数据
        List<Object[]> newDataList = new ArrayList<Object[]>();
        for(int a=0;a<dataList.size();a++){
            objs1 = new Object[data.size()];
            for(int j=0;j<data.size();j++){
                objs1[j]=dataList.get(a)[Integer.parseInt(data.get(j))];
            }
            newDataList.add(objs1);
        }
        ExportExcel ex = new ExportExcel(title, rowsName, newDataList, response);
        ex.export();
    }
    private void sendMessage(String jsonData) {
        List<JSONObject> jsonObjectList = null;
        if (!org.apache.commons.lang3.StringUtils.isBlank(jsonData)) {
            jsonObjectList = FastJsonConvert.convertJSONToArray(jsonData, JSONObject.class);
        }
        if (null != jsonObjectList && jsonObjectList.size() > 0) {
            TextMessage textMessage = new TextMessage(BaseUtils.succsessArrHourTimeRespond(jsonObjectList), true);
            try {
                myWebSocketHandler.sendMsgToAllUsers(textMessage);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}


